package com.glacier.thread;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

/**
 * date 2024-01-03 13:49
 *
 * @author glacier
 * @version 1.0
 */
@Data
@ToString
@EqualsAndHashCode(callSuper = false)
public class MyThread1 extends Thread {
    private boolean stop = false;

    @Override
    public void run() {
        while (!this.stop) {
            System.out.println(Thread.currentThread().getName() + " 正在执行");
            try {
                Thread.sleep((System.currentTimeMillis() % 1000) + 1);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
